#include "interface/plugin_base.h"

namespace OHOS {
namespace Media {
namespace Plugin {

#define CALL_WEAK_PTR_FUNC(weakPtr, func, param) \
    if (auto ptr = weakPtr.lock()) {             \
        ptr->func(param);                        \
    } else {                                     \
        MEDIA_LOG_E("WeakPtr is null when calling weakPtr func " #func);    \
    }

class PluginBaseImpl : public PluginBase {
public:
    explicit PluginBaseImpl(std::string name);
    Status Init() override;
    Status Deinit() override;
    Status Prepare() override;
    Status Reset() override;
    Status Start() override;
    Status Stop() override;
    bool IsParameterSupported(Tag tag) override;
    Status GetParameter(Tag tag, ValueType &value) override;
    Status SetParameter(Tag tag, const ValueType &value) override;
    Status GetState(State &state) override;
    std::shared_ptr<Allocator> GetAllocator() override;
    Status SetCallback(const std::shared_<Callback> &cb) override;

private:
    std::string name_;
    std::shared_ptr<Callback> callback_;
    std::shared_ptr<Allocator> allocator_;
};






}
}
}